﻿using System;

using MaLu.Common;
using System.Data;
using MaLu.Data;
using MaLu.Framework.Common;


namespace MaluJg.web.Move
{
    public partial class item1 : MovePage
    {
        public Guid DepartmentID
        {
            get
            {
                if (Request["DepartmentID"] != null)
                    return new Guid(Request["DepartmentID"]);
                return Guid.NewGuid();
            }
        }



        protected void Page_Load(object sender, EventArgs e)
        {
           
            if (!IsPostBack)
            {
                DataTable dt = SqlHelper.Instance.ExecuteDataTable(Provider,"select  * from moving where id="+MID);
                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    tbPingGu.Text = dr["PingGu"].ToString();
                    tbTuDiBuChangJinE.Text = dr["TuDiBuChangJinE"].ToString();
                    tbTingGong.Text = dr["TingGong"].ToString();
                    tbGeLeiJiangli.Text = dr["GeLeiJiangli"].ToString();
                    tbXieYiJia.Text = dr["XieYiJia"].ToString();
                    tbFirstRemark.Text = dr["FirstRemark"].ToString();
                  
                
                }
              
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string sql = string.Format(@"UPDATE [Moving]
   SET [PingGu] ={0}
      ,[TuDiBuChangJinE] ={1}
      ,[TingGong] = {2}
      ,[GeLeiJiangli] = {3}
      ,[XieYiJia] = {4}
      ,[FirstRemark] = {5},First=1 where ID={6}", Util.ReturnSqlValue(tbPingGu.Text), Util.ReturnSqlValue(tbTuDiBuChangJinE.Text),
                                   Util.ReturnSqlValue(tbTingGong.Text) ,Util.ReturnSqlValue(tbGeLeiJiangli.Text),
                                   Util.ReturnSqlValue(tbXieYiJia.Text),Util.ReturnSqlValue(tbFirstRemark.Text),MID);
            SqlHelper.Instance.ExecuteNonQuery(Provider,sql);


             ClientScript.RegisterStartupScript(this.GetType(), "Close", "<script>alert('成功保存!');</script>");
        }
    
    }
}
